<!DOCTYPE html>
<html>
		<meta http-equiv="Content-type" content="text/html; charset=utf-8">
		<title>doh.robot MVC Generate View Test</title>

		<style>
			@import "../../../../../util/doh/robot/robot.css";
		</style>

		<!-- required: dojo.js -->
		<script type="text/javascript" src="../../../../../dojo/dojo.js"
			djConfig="isDebug: true, parseOnLoad: true"></script>

		<script type="text/javascript" src="../helpers.js"></script>

		<script type="text/javascript">
			dojo.require("dijit.robotx");

			dojo.addOnLoad(function(){
				doh.robot.initRobot('../test_mvc_generate-view.html');

				doh.register("on_test_MVC_Search_Results_Repeat", [
					 {
						name: "initial conditions",
						timeout: 9000,
						runTest: function(){
						var d = new doh.Deferred();
						console.debug("dojo.version() is "+dojo.version);
						
						doh.robot.sequence(d.getTestCallback(function(){
							doh.is("360324", dijit.byId("view_t0").get('value'),"view_t0 should be set");
							doh.is("John", dijit.byId("view_t1").get('value'),"view_t1 should be set");
							doh.is("Doe", dijit.byId("view_t2").get('value'),"view_t2 should be set");
							doh.is("jdoe@example.com", dijit.byId("view_t3").get('value'),"view_t3 should be set");
						}), 1000);
						return d;
						}
					 },
					{
						name: "changeJohn",
						timeout: 18000,
						runTest: function(){
							var d = new doh.Deferred();

							doh.robot.mouseMoveAt("view_t0", 500, 0);
							doh.robot.mouseClick({left:true}, 500);
							doh.robot.keyPress(dojo.keys.TAB, 500, {shift:true});

							// ensure we've reached top left of text area x-browser
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 

							doh.robot.keyPress(dojo.keys.LEFT_ARROW, 200, {});

							// navigate to end of first name in JSON in textarea

							doh.robot.keyPress(dojo.keys.DOWN_ARROW, 200, {});						   
							doh.robot.keyPress(dojo.keys.DOWN_ARROW, 200, {});						   
							doh.robot.keyPress(dojo.keys.DOWN_ARROW, 200, {});						   

							doh.robot.keyPress(dojo.keys.LEFT_ARROW, 200, {});						   
							doh.robot.keyPress(dojo.keys.LEFT_ARROW, 200, {});						   
							doh.robot.keyPress(dojo.keys.LEFT_ARROW, 200, {});						   

							doh.robot.typeKeys("ny", 500, 1000);													 
							doh.robot.mouseMoveAt("view_t0", 500, 0);
							doh.robot.mouseClick({left:true}, 500);

							doh.robot.sequence(d.getTestCallback(function(){
								doh.is("360324", dijit.byId("view_t0").get('value'),"view_t0 should be set");
								doh.is("Johnny", dijit.byId("view_t1").get('value'),"view_t1 should be set");
								doh.is("Doe", dijit.byId("view_t2").get('value'),"view_t2 should be set");
								doh.is("jdoe@example.com", dijit.byId("view_t3").get('value'),"view_t3 should be set");
							}), 1000);
							return d;
						}
					},
					{
						name: "addMiddle",
						timeout: 18000,
						runTest: function(){
							var d = new doh.Deferred();
							
							doh.robot.mouseMoveAt("view_t0", 500, 0);
							doh.robot.mouseClick({left:true}, 500);
							doh.robot.keyPress(dojo.keys.TAB, 500, {shift:true});

							// ensure we've reached top left of text area x-browser

							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 
							doh.robot.keyPress(dojo.keys.UP_ARROW, 200, {});						 

							doh.robot.keyPress(dojo.keys.LEFT_ARROW, 200, {});

							// navigate to end of first name in JSON in textarea

							doh.robot.keyPress(dojo.keys.DOWN_ARROW, 200, {});						   
							doh.robot.keyPress(dojo.keys.DOWN_ARROW, 200, {});						   
							doh.robot.keyPress(dojo.keys.DOWN_ARROW, 200, {});

							doh.robot.typeKeys('    "Middle" : "J.",', 500, 1000);													 
							doh.robot.keyPress(dojo.keys.ENTER, 100, {});						  
							doh.robot.mouseMoveAt("view_t0", 500, 0);
							doh.robot.mouseClick({left:true}, 500);

							doh.robot.sequence(d.getTestCallback(function(){
								doh.is("360324", dijit.byId("view_t0").get('value'),"view_t0 should be set");
								doh.is("Johnny", dijit.byId("view_t1").get('value'),"view_t1 should be set");
								doh.is("J.", dijit.byId("view_t2").get('value'),"view_t2 should be set");
								doh.is("Doe", dijit.byId("view_t3").get('value'),"view_t3 should be set");
								doh.is("jdoe@example.com", dijit.byId("view_t4").get('value'),"view_t4 should be set");

								doh.is("2010", dijit.byId("view_t18").get('value'),"view_t18 should be set");
								doh.is("Gold", dijit.byId("view_t19").get('value'),"view_t19 should be set");
							}), 1000);
							return d;
						}
					}
				]);
				doh.run();
			});
		</script>
</html>
